using System;
using System.Collections.Generic;
using NHibernate.Search.Attributes;
using NHibernate.Search;

namespace Ic.Model
{
	#region BandUser

	/// <summary>
	/// BandUser object for NHibernate mapped table 'TB_BandUser'.
	/// </summary>
	[Serializable]
	[TableInfo(TableName = "TB_BandUser", PrimaryKey = "Id" , Columns="Id,UserLogonName,UserTrueName,UserEmail,UserPwd,UserIntro,UserPhoto,UserSex,UserProvince,UserCity,UserBirthDate,RegDate,UpdateDate,UserIsBandsman,isBlock,BlockReason,BlockExpire")]
	[Indexed(Index = "BandUser")] 
	public class BandUser
	{
		#region Member Variables
		
		protected int _id;
		protected string _userLogonName;
		protected string _userTrueName;
		protected string _userEmail;
		protected string _userPwd;
		protected string _userIntro;
		protected string _userPhoto;
		protected string _userSex;
		protected string _userProvince;
		protected string _userCity;
		protected DateTime _userBirthDate;
		protected DateTime _regDate;
		protected DateTime _updateDate;
		protected bool _userIsBandsman;
		protected bool _isBlock;
		protected string _blockReason;
		protected DateTime _blockExpire;
		/*protected IList<Band> _bandCreatorUidTBBands;*/
		/*protected IList<Bandsman> _userTBBandsmans;*/

		#endregion

		#region Constructors

		public BandUser() { }

		public BandUser( string userLogonName, string userTrueName, string userEmail, string userPwd, string userIntro, string userPhoto, string userSex, string userProvince, string userCity, DateTime userBirthDate, DateTime regDate, DateTime updateDate, bool userIsBandsman, bool isBlock, string blockReason, DateTime blockExpire )
		{
			this._userLogonName = userLogonName;
			this._userTrueName = userTrueName;
			this._userEmail = userEmail;
			this._userPwd = userPwd;
			this._userIntro = userIntro;
			this._userPhoto = userPhoto;
			this._userSex = userSex;
			this._userProvince = userProvince;
			this._userCity = userCity;
			this._userBirthDate = userBirthDate;
			this._regDate = regDate;
			this._updateDate = updateDate;
			this._userIsBandsman = userIsBandsman;
			this._isBlock = isBlock;
			this._blockReason = blockReason;
			this._blockExpire = blockExpire;
		}

		#endregion

		#region Public Properties

		[DocumentId]
		public virtual int Id
		{
			get {return _id;}
			set {_id = value;}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserLogonName
		{
			get { return _userLogonName; }
			set
			{
				if ( value != null && value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for UserLogonName", value, value.ToString());
				_userLogonName = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserTrueName
		{
			get { return _userTrueName; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for UserTrueName", value, value.ToString());
				_userTrueName = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserEmail
		{
			get { return _userEmail; }
			set
			{
				if ( value != null && value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for UserEmail", value, value.ToString());
				_userEmail = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserPwd
		{
			get { return _userPwd; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for UserPwd", value, value.ToString());
				_userPwd = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserIntro
		{
			get { return _userIntro; }
			set
			{
				_userIntro = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserPhoto
		{
			get { return _userPhoto; }
			set
			{
				if ( value != null && value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for UserPhoto", value, value.ToString());
				_userPhoto = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserSex
		{
			get { return _userSex; }
			set
			{
				if ( value != null && value.Length > 6)
					throw new ArgumentOutOfRangeException("Invalid value for UserSex", value, value.ToString());
				_userSex = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserProvince
		{
			get { return _userProvince; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for UserProvince", value, value.ToString());
				_userProvince = value;
			}
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string UserCity
		{
			get { return _userCity; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for UserCity", value, value.ToString());
				_userCity = value;
			}
		}

		public virtual DateTime UserBirthDate
		{
			get { return _userBirthDate; }
			set { _userBirthDate = value; }
		}

		public virtual DateTime RegDate
		{
			get { return _regDate; }
			set { _regDate = value; }
		}

		public virtual DateTime UpdateDate
		{
			get { return _updateDate; }
			set { _updateDate = value; }
		}

		public virtual bool UserIsBandsman
		{
			get { return _userIsBandsman; }
			set { _userIsBandsman = value; }
		}

		public virtual bool IsBlock
		{
			get { return _isBlock; }
			set { _isBlock = value; }
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string BlockReason
		{
			get { return _blockReason; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for BlockReason", value, value.ToString());
				_blockReason = value;
			}
		}

		public virtual DateTime BlockExpire
		{
			get { return _blockExpire; }
			set { _blockExpire = value; }
		}

		public virtual IList<Band> BandCreatorUidTB_Bands
		{
			get;set;
			#region remove
			/*
			get
			{
				if (_bandCreatorUidTBBands==null)
				{
					_bandCreatorUidTBBands = new List<Band>();
				}
				return _bandCreatorUidTBBands;
			}
			set { _bandCreatorUidTBBands = value; }
			*/
			#endregion
		}

		public virtual IList<Bandsman> UserTB_Bandsmans
		{
			get;set;
			#region remove
			/*
			get
			{
				if (_userTBBandsmans==null)
				{
					_userTBBandsmans = new List<Bandsman>();
				}
				return _userTBBandsmans;
			}
			set { _userTBBandsmans = value; }
			*/
			#endregion
		}

		

		#endregion
	}
	#endregion
}